package es.castorm.arch.mapping.config;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
public class MappingConfig {

	@Bean
	public MapperFactory mapperFactory() {
		MapperFactory factory = new DefaultMapperFactory.Builder().build();
		return factory;
	}

	@Bean
	@Scope("prototype")
	public MapperFacade mapperFacade() {
		MapperFacade mapper = mapperFactory().getMapperFacade();
		return mapper;
	}
}
